
#ifndef __S51_IO_I2C_H__
#define __S51_IO_I2C_H__

#include "../../Core/Simple51core.h"
#define HAL_I2C_CONNECT_FAILED 0x00  /*I2C通信失败*/
#define HAL_I2C_CONNECT_SUCCESS 0x01 /*I2C通信成功*/



#define pin_SDA_1_HIGH 
#define pin_SDA_1_LOW
#define pin_SDA_1_READ()

#define pin_SCL_1_HIGH
#define pin_SCL_1_LOW
#define pin_SCL_1_READ()


#define HI2C_1 0
#define HI2C_2 1

typedef struct
{
    uint8_t Speed;        /**/
    uint8_t rxBuf;        /**/
    uint8_t txBuf;        /**/
    uint8_t BitOrder : 1; /**/
    uint8_t Mode : 1;
    uint8_t Instance : 2;
    uint8_t nullbit : 2;
} I2C_HandleTypeDef;


uint8_t S51_I2C_Init(I2C_HandleTypeDef *hi2c);
uint8_t S51_I2C_Master_Transmit(I2C_HandleTypeDef *hi2c, uint8_t _address, uint8_t *_pData, uint8_t _datasize, uint8_t _timeout);
uint8_t S51_I2C_Master_Deceiver(I2C_HandleTypeDef *hi2c, uint8_t _address, uint8_t *_pData, uint8_t _datasize, uint8_t _timeout);

#endif